package com.jixiantubu.adapter;

import java.util.ArrayList;
import java.util.List;

import com.example.jixiantubu.R;
import com.jixiantubu.bean.ReplyInfoBean;
import com.jixiantubu.util.NoScrollListView;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class Reply_ReplyAdapter extends BaseAdapter {

	List<ReplyInfoBean> list;
	Context context;
	LayoutInflater mInflater;
	ViewHolder mHolder;
	String username;

	public Reply_ReplyAdapter(Context context, List<ReplyInfoBean> list,String username) {
		super();
		this.list = list;
		this.context = context;
		this.username=username;
		mInflater = LayoutInflater.from(context);
	}

	public List<ReplyInfoBean> getList() {
		return list;
	}

	public void setList(List<ReplyInfoBean> list) {
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int arg0) {
		return list.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(final int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.reply_info_item, null);
			mHolder = new ViewHolder();
			mHolder.textView1 = (TextView) convertView
					.findViewById(R.id.reply_rusername_textview);
			mHolder.textView2 = (TextView) convertView
					.findViewById(R.id.reply_rhuifun_content_textview);
			mHolder.imageView=(ImageView)convertView.findViewById(R.id.huifu_reply);
			convertView.setTag(mHolder);
		} else {
			mHolder = (ViewHolder) convertView.getTag();
		}
		mHolder.textView1.setText(list.get(position).getReplyname() + ":");
		mHolder.textView2.setText("回复  " + list.get(position).getName() + ":"
					+ list.get(position).getContent() + "  "
					+ list.get(position).getCreateTime());
			
	/*	List<ReplyInfoBean> list=new ArrayList<ReplyInfoBean>();
		for (ReplyInfoBean replyInfoBean : list) {
			if (replyInfoBean.) {
				
			}*/
		
		return convertView;
	}
	
	class ViewHolder {
		TextView textView1;
		TextView textView2;
		ImageView imageView;
		NoScrollListView listView ;
	}

}
